package linwen.wang.common.resp;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @ClassName BaseResp
 * @Description TODO
 * @Author zero
 * @DATE 2024/6/4 2:34 AM
 * @Version 1.0
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseResp<T> {
    private int code;
    private String msg;
    private T data;


    public static <T> BaseResp<T> success(T data) {
        return new BaseResp<>(200, "success", data);
    }
    public static BaseResp<Void> success() {
        return success(null);
    }

    public static <T> BaseResp<T> fail(int code, String message) {
        return new BaseResp<>(code, message, null);
    }
}
